package com.luoguijia.disk.recycle.control;

import com.alibaba.fastjson.JSON;
import com.luoguijia.disk.mybatis.entity.PtFileEntity;
import com.luoguijia.disk.mybatis.flexigrid.PagingEntity;
import com.luoguijia.disk.mybatis.flexigrid.TblResponseEntity;
import com.luoguijia.disk.recycle.entity.SearchRecycleEntity;
import com.luoguijia.disk.recycle.service.RecycleService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/recycle")
public class RecycleController {

    @Resource
    private RecycleService recycleService;

    @RequestMapping("/recycleAll")
    public String recycleAll(){
        return "recycle/recyclePage";
    }

    @RequestMapping("/file")
    public String file() {
        // 这里根据实际需求返回对应的视图名称，比如下面这样假设也返回 recyclePage
        return "recycle/recyclePage";
    }

    @RequestMapping("/queryRecycleInfoListByPage")
    @ResponseBody
    public String queryRecycleInfoListByPage(SearchRecycleEntity entity, PagingEntity paging){
        TblResponseEntity<PtFileEntity> tblResponseEntity = recycleService.queryRecycleInfoListByPage(entity,paging);

        return JSON.toJSONString(tblResponseEntity);
    }


}
